class Lough < ActiveRecord::Base
  include ConfigManager
  
  belongs_to :user
  has_many :articles
  
  validates_presence_of :screen_name
  validates_uniqueness_of :screen_name
  
  serialize :settings, Hash
  
  # Description
  setting :lough_name,        :string, ''
  setting :about_owner,       :string, ''
  setting :copy_right,        :string, ''
  
  # Articles
  setting :article_per_page,  :integer, 10
  
  def initialize(*args)
    super
    
    begin
      self.settings ||= {}
    rescue
      self.settings = {}
    end
  end

end
